import { HomeOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons';
import type { ComponentType, ReactNode } from 'react';

// 静态条件导入（每个路径都是静态的）
const icons: Recordable<ComponentType> = {
  home: HomeOutlined,
  user: UserOutlined,
  setting: SettingOutlined,
};

type DynamicIconFN = (params: { icon: string }) => ReactNode;

export const DynamicIcon: DynamicIconFN = ({ icon }) => {
  const IconComponent = icons[icon] ?? '';
  return <IconComponent />;
};
